package xyz.lisys.boot.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import xyz.lisys.boot.pojo.User;

import java.util.List;


public interface UserMapper {

    @Results({
            @Result(property = "id", column = "ced_user_id"),
            @Result(property = "name", column = "ced_user_name"),
            @Result(property = "phone", column = "ced_user_phone"),
            @Result(property = "password", column = "ced_user_password"),
            @Result(property = "gender", column = "ced_user_gender"),
            @Result(property = "intro", column = "ced_user_intro"),
            @Result(property = "email", column = "ced_user_email"),
            @Result(property = "address", column = "ced_user_address"),
            @Result(property = "industry", column = "ced_user_industry"),
            @Result(property = "edu", column = "ced_user_edu"),
            @Result(property = "isBoss", column = "ced_is_boss"),
            @Result(property = "createTime", column = "ced_create_time"),
            @Result(property = "createPower", column = "ced_create_power"),
            @Result(property = "head", column = "ced_user_head")
    })
    @Select("select ced_user_id, ced_user_name, ced_user_phone, ced_user_password, ced_user_gender, " +
            "ced_user_intro, ced_user_email, ced_user_address, ced_user_industry, ced_user_edu, " +
            "ced_is_boss, ced_create_time, ced_create_power, ced_user_head from ced_users;")
    public List<User> findAllUser();

    @Insert("insert into ced_users (ced_user_name, ced_user_phone, ced_user_password) " +
            "values(#{name}, #{phone}, #{password})")
    public void insertUser(User user);
}
